﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.PlanningManagement;
using Digitalmes.Model.FactoryManagement;
using Digitalmes.Model.ProductManagement;

namespace Digitalmes.Model.PlanningManagement
{
    /// <summary>
    /// ProductionPlanning
    /// </summary>
	[Table("ProductionPlanning")]

    [Display(Name = "_Model.ProductionPlanning")]
    public class ProductionPlanning : BasePoco,IPersistPoco,ITenant
    {
        [Display(Name = "_Model._ProductionPlanning._Wo")]
        [Comment("工单号")]
        public string Wo { get; set; }
        [Display(Name = "_Model._ProductionPlanning._Sort")]
        [Comment("排序")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public int? Sort { get; set; }
        [Display(Name = "_Model._ProductionPlanning._LineId")]
        [Comment("产线")]
        public long? LineId { get; set; }

        public ProductionLine Line { get; set; }    

        [Display(Name = "_Model._ProductionPlanning._LineCode")]
        [Comment("产线编码")]
        public string LineCode { get; set; }
        [Display(Name = "_Model._ProductionPlanning._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }

        public Product Product { get; set; }


        [Display(Name = "_Model._ProductionPlanning._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._ProductionPlanning._PlanStartTime")]
        [Comment("计划开始时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? PlanStartTime { get; set; }
        [Display(Name = "_Model._ProductionPlanning._PlanEndTime")]
        [Comment("计划结束时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? PlanEndTime { get; set; }
        [Display(Name = "_Model._ProductionPlanning._PlanQty")]
        [Comment("计划数量")]
        [Precision(18,2)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? PlanQty { get; set; }
        [Display(Name = "_Model._ProductionPlanning._ProductCode")]
        [Comment("产品名称")]
        public string ProductCode { get; set; }
        [Display(Name = "_Model._ProductionPlanning._PlanStatus")]
        [Comment("计划状态")]
       
        public WoStatusEnum? PlanStatus { get; set; }
        [Key]
        [Display(Name = "_Model._ProductionPlanning._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ProductionPlanning._ShiftId")]
        [Comment("班次")]
        public long? ShiftId { get; set; }

        public LineShift Shift { get; set; }    

        [Display(Name = "_Model._ProductionPlanning._ShiftCode")]
        [Comment("班次代号")]
        public string ShiftCode { get; set; }
        [Display(Name = "_Model._ProductionOrder._Plan")]
        [InverseProperty("Plan")]
        public List<ProductionOrder> ProductionOrder_Plan { get; set; }
        [Display(Name = "_Model._ProductionPlanning._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
